

#import "BankAcount.h"
@implementation BankAcount
@synthesize openingBalance=_openingBalance;
-(id)init{
    self=[super init];
    if(self){
        [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(balanceUpdate:) userInfo:nil repeats:YES];
    }
    return self;
}
-(void)balanceUpdate:(id)arg{
    float f=self.openingBalance;
    f+=arc4random()%100;
    _test=10;
    NSLog(@"hello=%f",_test);
    //1
   // self.openingBalance=f;
    //2
    //[self setValue:[NSNumber numberWithFloat:f] forKey:@"openingBalance"];
    //3
    [self willChangeValueForKey:@"openingBalance"];
    _openingBalance=f;
    [self didChangeValueForKey:@"openingBalance"];
}

@end
